<template>
	<view class="content">
		<view class="section-0">
			<view class="section-body">
				<view class="tab">
					<view  @click="setCurIdx(idx, item.id)" :class="`item ${curIdx === idx ? 'item__active' : ''} ${curIdx + 1 === idx ? 'item__active_next' : ''}`" v-for="(item, idx) in tabList" :key="item.id">
						<view class="label">{{item.name}}</view>
						<view class="shape">
							<view class="shape-body"></view>
						</view>
						<view class="shape shape-mirrow">
							<view class="shape-body"></view>
						</view>
					</view>
				</view>
				<view class="list" v-if="list.filter(e => e.status == curId).length">
					<view class="item" v-for="item in list.filter(e => e.status == curId)" :key="item.id">
						<view class="left">
							<view class="name">{{item.receive_user}}</view>
							<!-- <view class="time">
								履职人：<text style="margin-right: 20rpx;">{{item.user_name}}</text>
								<text style="float: right;">{{item.dk_time_in}}</text>
							</view>
							<view class="time">地点：<text>{{item.dk_address}}</text></view> -->
						</view>
					</view>
				</view>
				<view v-else>
					<view class="custom-empty">
						<text class="iconfont icon-zanwushuju"></text>
						<view class="empty-title">暂无数据</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { todoReceiveListApi } from '@/api/todo.js';
	export default {
		data() {
			return {
				id: 0,
				tabList: [
					{ id: 2, name: '已完成'},
					{ id: 1, name: '未完成'}
				],
				curIdx: 0,
				curId: 2,
				list: [],
			}
		},
		methods: {
			setCurIdx(idx, id) {
				this.curIdx = idx;
				this.curId = id;
			},
			async todoReceiveList() {
				uni.showLoading({title: '加载中...'});
				const { data } = await todoReceiveListApi({id: this.id});
				uni.hideLoading();
				if (data.code === 1) {
					this.list = data.data.list;
				}
			},
		},
		onLoad(data) {
			this.id = data.id;
		},
		onReady() {
			this.todoReceiveList();
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #fff;
	}
	.section-0{
		width: 100%;
		background-color: #3759f2;
		.section-body{
			width: 100%;
			border-top-left-radius: 40rpx;
			border-top-right-radius: 40rpx;
			background-color: #1534ce;
			overflow: hidden;
			.tab{
				width: 100%;
				height: 80rpx;
				@include clear();
				background-color: #1534ce;
				.item{
					width: 50%;
					float: left;
					height: 80rpx;
					background-color: #1534ce;
					position: relative;
					.label{
						height: 80rpx;
						line-height: 80rpx;
						position: relative;
						z-index: 10;
						box-sizing: border-box;
						text-align: center;
						width: 100%;
						font-size: 26rpx;
						font-weight: normal;
						font-stretch: normal;
						letter-spacing: 0rpx;
						color: #ffffff;
					}
					.shape{
						z-index: 1;
						width: 50rpx;
						height: 50rpx;
						position: absolute;
						bottom: 0;
						left: -50rpx;
						background: #000;
						display: none;
						background-color: #fff;
						overflow: hidden;
						.shape-body{
							width: 50rpx;
							height: 50rpx;
							background-color: #1534ce;
							border-bottom-right-radius: 40rpx;
						}
					}
					.shape-mirrow{
						z-index: 1;
						left: 0;
						display: none;
						.shape-body{
							border-bottom-right-radius: 0rpx;
							border-bottom-left-radius: 40rpx;
						}
					}
				}
				.item__active{
					border-top-left-radius: 40rpx;
					border-top-right-radius: 40rpx;
					background-color: #fff;
					.label{
						color: #46464a;
					}
					.shape{
						display: block;
					}
					.shape-mirrow{
						display: none;
					}
				}
				.item__active_next{
					border-bottom-right-radius: 50rpx;
					.shape{
						display: none;
					}
					.shape-mirrow{
						display: block;
					}
				}
			}
			.list{
				padding-top: 30rpx;
				padding-left: 27rpx;
				padding-right: 27rpx;
				padding-bottom: 30rpx;
				box-sizing: border-box;
				background-color: #fff;
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;
				.item{
					width: 100%;
					background-color: #ffffff;
					border-radius: 35rpx;
					box-shadow: 0 0 20rpx 10rpx rgba(#bcbcb5, 0.17);
					box-sizing: border-box;
					padding: 30rpx;
					@include clear();
					margin-bottom: 23rpx;
					.left{
						float: left;
						width: 100%;
						.name{
							height: 30rpx;
							width: 100%;
							font-size: 26rpx;
							font-weight: bold;
							font-stretch: normal;
							line-height: 34rpx;
							letter-spacing: 0rpx;
							color: #46464a;
							padding-top: 5rpx;
							padding-bottom: 5rpx;
						}
						.time{
							width: 100%;
							padding-top: 17rpx;
							font-size: 16rpx;
							font-weight: normal;
							font-stretch: normal;
							letter-spacing: 0rpx;
							color: #7f98ae;
						}
					}
					
				}
				
			}
		}
	}
</style>
